<template>
    <div>
        
        <div style="width:340px;text-align:center;margin:0 auto">
          <div style="line-height:60px"> 销售员姓名 <el-input type="text" v-model="personalData.names" style="width:220px;height:60px" autocomplete="on"></el-input></div>
         <div style="line-height:60px">  电话 <el-input type="text" v-model="personalData.phonenum" style="width:220px;height:60px"></el-input></div>
         <div style="line-height:60px">  账号 <el-input type="text" v-model="personalData.account" style="width:220px;height:60px"></el-input></div>
         <div style="line-height:60px">  密码 <el-input type="text" v-model="personalData.password" style="width:220px;height:60px"></el-input></div>
         
          
        </div>
        <button @click="updateSalespersons(personalData)">确认修改</button>
    </div>
</template>

<script>
import axios from "axios";
import { createNamespacedHelpers } from "vuex";
const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
    "salespersons"
);
export default {
    props:['_id'],
    data(){
        return{
            personalData:{
                
            }
        }
    },
    
    computed:{
      ...mapState(['PersonalchangeData'])
    },
    watch:{
        PersonalchangeData(newName, oldName){
        this.personalData=this.PersonalchangeData;
        
        },
        deep: true,
        immediate:true
    },
    created(){
        this.getSalespersons();
        console.log('id',this.personalData);
        this.getSalespersonsById(this._id);
    },
    
    methods: {
        ...mapActions(["getSalespersons",'getSalespersonsById','updateSalespersons']),
        
       
    },
};
</script>

<style>

</style>